﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DataMappers;
using ExaminationTT.Model;

namespace ConcreteMappersAndObjects.DomainObjects
{
    public struct TeacherClassCUnitKey
    {

        public TeacherClassCUnitKey(int teacherKey, int classKey, int cunitKey)
        {
            TeacherKey = teacherKey;
            ClassKey = classKey;
            CUnitKey = cunitKey;
        }

        public int TeacherKey
        {
            get { return TeacherKey; }
            private set { TeacherKey = value; }
        }

        public int ClassKey
        {
            get { return ClassKey; }
            private set { ClassKey = value; }
        }

        public int CUnitKey
        {
            get { return CUnitKey; }
            private set { CUnitKey = value; }
        }

    }
    public class TeacherClassCUnit : DomainObject<TeacherClassCUnitKey, TeacherClassCUnit> , ITeacherClassCUnit
    {
        protected override TeacherClassCUnit Self()
        {
            return this;
        }

        private IValueHolder<int, Teacher> _teacher;
        private IValueHolder<int, CUnit> _cunit;
        private IValueHolder<int, SClass> _sclass;

        public TeacherClassCUnit()
            : base()
        {
            _teacher = new ConcreteValueHolder<int, Teacher>();
            _cunit = new ConcreteValueHolder<int, CUnit>();
            _sclass = new ConcreteValueHolder<int, SClass>();
        }


        public TeacherClassCUnit(TeacherClassCUnitKey id, IValueHolder<int, Teacher> teacher,
                                    IValueHolder<int, CUnit> cunit,
                                    IValueHolder<int, SClass> sclass) : base(id)
        {
            _teacher = teacher;
            _cunit = cunit;
            _sclass = sclass;
        }

        public Teacher Teacher
        {
            get { return _teacher.Get(); }
            set { _teacher.Set(value); }
        }

        public SClass Class
        {
            get { return _sclass.Get(); }
            set { _sclass.Set(value); }
        }

        public CUnit CUnit
        {
            get { return _cunit.Get(); }
            set { _cunit.Set(value); }
        }


        #region ITeacherClassCUnit Members

        ITeacher ITeacherClassCUnit.Teacher
        {
            get { return _teacher.Get(); }
        }

        IClass ITeacherClassCUnit.Class
        {
            get { return _sclass.Get(); }
        }

        ICUnit ITeacherClassCUnit.CUnit
        {
            get { return _cunit.Get(); }
        }

        #endregion
    }
}
